<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/29
 * Time: 16:18
 */

namespace app\api\model;


class Category extends BaseModel
{
        protected $hidden = ['delete_time','update_time'];
        public function img(){
            return $this->belongsTo('Image','topic_img_id','id');
        }

    /*获取分类*/
        public static function getAllCategorys(){
//            $categorys = self::with('img')->select();
            $categorys = self::all([],'img');
            return $categorys;
        }
}